<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl() ;?>/css/thumau.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl() ;?>/css/guithu.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl() ;?>/upload/styles.css" media="screen" />
<!-- Call calenda  -->
    <script src="<?php echo $this->baseUrl() ;?>/scripts/calenda/js/jscal2.js"></script>
    <script src="<?php echo $this->baseUrl() ;?>/scripts/calenda/js/lang/vi.js"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl() ;?>/scripts/calenda/css/jscal2.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl() ;?>/scripts/calenda/css/border-radius.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl() ;?>/scripts/calenda/css/steel/steel.css" />
	
<!-- End call calenda -->
<script src="<?php echo $this->baseUrl() ;?>/scripts/guithu.js" type="text/javascript"></script>
<script src="<?php echo $this->baseUrl() ;?>/scripts/thunhap.js" type="text/javascript"></script>
<script src="<?php echo $this->baseUrl() ;?>/scripts/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<script src="<?php echo $this->baseUrl() ;?>/scripts/tiny_mce/jquery.tinymce.js" type="text/javascript"></script>
<script src="<?php echo $this->baseUrl() ;?>/upload/ajaxupload.3.5.js" type="text/javascript"></script>
 <script type="text/javascript">
  calltinymce();
  uploadfilenhapsua();
</script>
<div class ="conten" >

    <table cellpadding="0"  cellspacing="0" class="tableconten" border="0">
        <tr>
            <td class="left_conten" >
            <!-- left  -->
               <div class="module-left">
                      <div class="t_m">
            			<div class="t_r">
            				<h3> 
                                Tạo mới 
            					<a class="toggleicon" href='#'><div onclick="slidetoggle('99')" class='shboxs99 show'><img src="<?php echo $this->baseUrl() ;?>/images/box/down1.png" /></div><div onclick="hslidetoggle('99')" class='hshboxs99 hidden'><img src="<?php echo $this->baseUrl() ;?>/images/box/down2.png" /></div></a>
            				</h3>
            				
            			</div>
            		  </div>
            		  <div id="box99" class="module-content">
            			<ul>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href="<?php echo $this->baseUrl()?>/thumau/themthumau"   >Thêm thư mẫu  </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href="<?php echo $this->baseUrl()?>/lienhe/">Thêm liên hệ</a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href=""> Gửi thư </a></li>
            				
            			</ul>
            		  </div>
            		  <div class="module-bottom">
            			<div class="md-bt-r"><div class="md-bt-l">&nbsp;</div></div>
            		  </div>	                  
               </div>
               
               <!-- thao tac 2 -->
               
               <div class="module-left">
                      <div class="t_m">
            			<div class="t_r">
            				<h3> 
                                Danh Sách
            					<a class="toggleicon" href='#'><div onclick="slidetoggle('98')" class='shboxs98 show'><img src="<?php echo $this->baseUrl() ;?>/images/box/down1.png" /></div><div onclick="hslidetoggle('98')" class='hshboxs98 hidden'><img src="<?php echo $this->baseUrl() ;?>/images/box/down2.png" /></div></a>
            				</h3>
            				
            			</div>
            		  </div>
            		  <div id="box98" class="module-content">
            			<ul>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thunhap/"   >Danh sách thư nháp </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thumau/index/"   >Danh sách thư mẫu </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/lienhe/" >Danh Sách liên hệ</a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thudagui/" > Danh sách thư đã gửi </a></li>
            				
            			</ul>
            		  </div>
            		  <div class="module-bottom">
            			<div class="md-bt-r"><div class="md-bt-l">&nbsp;</div></div>
            		  </div>	                  
               </div> 
               <!--  Lich âm dương -->
               <div class="module-left">
                      <div class="t_m">
            			<div class="t_r">
            				<h3> 
                               Lịch
            					<!--  <a class="toggleicon" href='#'><div onclick="slidetoggle('94')" class='shboxs94 show'><img src="<?php echo $this->baseUrl() ;?>/images/box/down1.png" /></div><div onclick="hslidetoggle('94')" class='hshboxs94 hidden'><img src="<?php echo $this->baseUrl() ;?>/images/box/down2.png" /></div></a>-->
            				</h3>
            				
            			</div>
            		  </div>
            		  <div id="box94" class="module-content">
            			<ul>

							<div id ="clendahee"  >
							<style>
								.DynarchCalendar-topCont {
								    width: 100% !important;
								}
            		        </style>
							 <script language="JavaScript">
							
            				var DISABLED_DATES = {
            					    20090502: true,
            					    20090505: true,
            					    20090510: true,
            					    20090511: true
            					};
            					Calendar.setup({
            					    cont     : "clendahee",
            					    disabled : function(date) {
            					        date = Calendar.dateToInt(date);
            					        return date in DISABLED_DATES;
            					    },
            				        showTime   : 24,
            				        dateFormat : "%d-%m-%Y",
            				        dateFormat : "%Y-%m-%d %I:%M %p"
            					});
							
							</script>
							</div>
            				
            			</ul>
            		  </div>
            		  <div class="module-bottom">
            			<div class="md-bt-r"><div class="md-bt-l">&nbsp;</div></div>
            		  </div>	                  
               </div>                            
               
            <!--  end left--> 
             </td>
            <td class="right_conten" >
            <div class="bao_benphai">
            <!-- right  -->
                <!-- breadcrumd-->
    			<div class="breadcrum" >
    				<ul>
    					<li class="home"><a href="<?php echo $this->baseUrl()?>/guithu/">Gửi thư </a></li>
    					<li class="br_item"><span>Sửa thư nháp</span></li>
    				</ul>
    			</div>
		    	<!-- end breadcrumd-->
		    	
		    	<!--  Start Thêm thư   -->
                <div class="" style="  min-height: 400px !important;">
                    <form method="POST" name="uploadform" id="uploadform"  action="<?php echo $this->baseUrl(); ?>/thunhap/sendmail"  onsubmit="return check_submit_sendmail();" >
				   <div class="tab_content"  style="display: block;">
		    		
		    		<!--  Bên trái -->
		    		<div class="left_conten_form" >
		    			<div class="eleRow">
		    				<div class="eleCaption">Gửi từ tài khoản:</div>
		    				<div class="eleBody">
		    					<input type="text" name="tenthumau" id="tenthumau" value="<?php echo $this->thonntincauhinh['user_name_email']?>" disabled="disabled" />
		    				</div>
		    			</div>

		    		</div>
		    		<!-- ben phải -->
		    		<div class="right_conten_form" >

		    			<div class="eleRow">
		    				<div class="eleCaption">Người tạo</div>
		    				<div class="eleBody">
		    					<input type="text" name="nguoitao" id="nguoitao" disabled="disabled" class="required email" value="<?php echo $this->name?>"/>
		    				</div>
		    				
		    			</div>		    				
		    			
			    						    						    		
		    		</div>
					
					<div class="khung_soanthumau">
                         
                             <div class="chu_vietnoidung">Gửi tới </div>
                             <div class="noidung_thu">
                             
                               <input type="hidden" id='arr_email' name='arr_email' value="<?php echo $this->thunhap['email_nguoinhan']?>" > 
                               <input type="hidden" id='arr_idlh' name='arr_idlh' value="<?php echo $this->thunhap['id_lh']?>"> 
                               <input type="hidden" id='chonlienhe' name='chonlienhe' value="<?php if($this->thunhap['id_lh'] != ''){echo 1;}else{echo 0;} ?>">
                               <input type="hidden" id="chontukhoa" name="chontukhoa" value="<?php if($this->thunhap['tk_id'] != ''){echo 1;}else{echo 0;}?>" > 
                               <input type="hidden" id="idtukhoa" name="idtukhoa" value="<?php echo $this->thunhap['tk_id']?>" > 
                               <textarea name='show_nguoinhan' class="gui_toi" id="gui_toi" onkeyup="timkiemlienhe(this.value);"  ><?php echo $this->thunhap['show_nguoinhan']?></textarea>
                               <div class="timkiem" id='lienhe_tim' > </div>
							   <span class="molienhe" onclick="popuplienhe('<?php  echo $this->iddangnhap; ?>')" > <img src="<?php echo $this->baseUrl() ?>/images/icon/icon-32-contacts_011.png" title="Chọn từ danh sách liên hệ"></span>
							   <span id="xoadulieu" onclick="xoadulieu()" > <img src="<?php echo $this->baseUrl() ?>/images/icon/icon-32-trash_01.png" title="Xóa địa chỉ"></span>
                             </div>
							<?php if($this->thunhap['tk_id'] == '0'){?>
							<div class="them_cc_bb">
								 <span ><a href="#" id='hiencc' onclick='hiencc();'> Thêm Cc</a> <a href="#" style="display:none;"  id='ancc' onclick='ancc();'> Ẩn Cc</a></span> 
								 <span class="thembcc"><a href="#" id='hienbcc' onclick='hienbcc();' >Thêm Bcc</a><a href="#" id='anbcc'style="display:none;" onclick='anbcc();' >Ẩn Bcc</a> </span> 
						   </div> 
						   <?php }?>
                           
                    </div>
					<div class="khung_soanthumau" <?php if($this->thunhap['cc_email'] == '' ){echo "style=\"display:none;\""; }?>  id='then_cc'>
                         
                             <div class="chu_vietnoidung">Cc:</div>
                             <div class="noidung_thu">
                               <textarea class="gui_toi" id="cc_" name="cc_" ><?php echo $this->thunhap['cc_email']?></textarea>
                             </div>
                           
                    </div>
					<div class="khung_soanthumau" <?php if($this->thunhap['bcc_email'] == '' ){echo "style=\"display:none;\""; }?> id='then_bcc'>
                         
                             <div class="chu_vietnoidung">Bcc:</div>
                             <div class="noidung_thu">
                               <textarea class="gui_toi" id="bcc_" name="bcc_"><?php echo $this->thunhap['bcc_email']?></textarea>
                             </div>
                           
                    </div>
					<div class="khung_soanthumau">
                         
                             <div class="chu_vietnoidung">Chủ dề :</div>
                             <div class="noidung_thu">
                               <input type="text" class="chu_de" name="chu_de" id="chu_de" value="<?php echo $this->thunhap['tieu_de']?>">
                             </div>
							
                           
                    </div>
					<div class="khung_soanthumau">
                         
                             <div class="chu_vietnoidung">  </div>
                             <div class="noidung_thu ">
                                <span class="iconthaotac" onclick = "getthumauguithu();" > <img src='<?php echo $this->baseUrl();?>/images/icon/icon-32-messaging_01.png' title="Chọn Thư mẫu"/></span> 
                                <span class="iconthaotac "  onclick = "chontukhoa();" > <img src='<?php echo $this->baseUrl();?>/images/icon/icon-32-article-add_01.png' title="Chọn Từ Khóa"/></span> 
                                <span class="iconthaotac" id="iconupl" onclick="dinhkem()"> <a href="#"><img src='<?php echo $this->baseUrl();?>/images/icon/icon-32-export_01.png' title="Đính kèm "/></a></span> 
                             </div>
							
                           
                    </div>
					<div class="khung_soanthumau" id='type_upl' >
                             <div class="chu_vietnoidung">  </div>
                             <div class="noidung_thu_dinhkem">
                             	<div class='dinhkem_uplad' ><div class="ten_dinhlem">File đính kèm :</div><div id="upload" ><span>Upload File<span></div><span id="status" style="display:none;" ><img src="<?php echo $this->baseUrl()?>/images/loadding.gif" /></span> </div>
							 <p>File đã upload :</p>     
                      			 <ul id="files">
                      			 <?php foreach ($this->filethunhap as $fileupload){?>
                      			  <li id="filechek_<?php echo $fileupload['dk_id']?>"><input type="checkbox" value="<?php echo $fileupload['link_file']?>" name="file[]" id="filechek_1" onclick="xoafileandb('<?php echo $fileupload['tenhinh']?>','<?php echo $fileupload['dk_id']?>');" checked="checked"><?php echo $fileupload['tenhinh']?></li>
                      			 <?php }?>
                      			 </ul>
                      			 <input type="hidden" name="tong_file" id="tong_file" value="<?php echo $this->thunhap['tong_files']?>">
                             </div>   
                    </div>
                    <!-- Div Tiny MCE  Soạn thảo thư mẫu -->
                    <div class="khung_soanthumau">
                         
                             <div class="chu_vietnoidung">Nội dung </div>
                             <div class="noidung_thu" id='body_thu'>
                                <textarea name="noidung_thu_soan" id="noidung_thu_soan">
                                	<?php echo $this->thunhap['noi_nung']?>
                                </textarea>
                             </div>
                           
                    </div>
                    <!-- Div Tiny MCE  Soạn thảo thư mẫu --> 
                  
		    		<!-- Day form  -->
		    		<!-- Hiddin -->
		    		<input type="hidden" value="" id="luunhap" name="luunhap">
		    		<!-- Hiddin -->
		    		<div class="day_form">
		    			<input type="hidden" value="<?php  echo $this->iddangnhap; ?>" name ="idnddn" id ="idnddn"/>
		    			<input type="hidden" value="<?php  echo $this->baseUrl(); ?>" id ="url"/>
		    			<input type="hidden" value="<?php  echo $this->thunhap['id_tg']; ?>" name ="idthunhap" id ="idthunhap"/>
						<input type="submit" class="blue_add"  onclick="sendmail()" value="Gửi thư" style="width:100px;" />
                        <input type="submit" class="save" onclick="save_nhap();" value="Lưu Lại" style="width:100px;" />
		    			<input type="button" onclick="javascript:history.go(-1);" class="delete" value="Hủy bỏ" style="width:100px;"/>
		    		</div>
			        </div>
			        </form>
                </div>
		    	<!--  End them thư  -->
		    	
		    </div>	
            <!-- right -->
            </td>
            
        </tr>
    
    </table>
</div>

<!-- Popup chon lien he -->
<div id='popuplienheguithu' title= " Chọn danh sách liên hệ " style="display:none;">
	<div class ="div_timkiem">
		<div class="left_tim" >
		<span class="tex_tim">Tìm : <input id="keytimkiem" type="text" name= "keytimkiem" ></span> 
		</div>
		<div class="right_tim" >
			<span class="tex_tim">Nhóm liên hệ : 
				<select name="nhomlienhe" id="id_nhomlh">
					
				</select>
			</span> 
		</div>
		<div class="div_tim"  >
		     <div class="divthaotac" title="Tìm Kiếm" align="center"> 
                    <a href="#" onclick="timkiemlienhepopup()">
	                   <span class="timkiemhinh"></span>
	                    Tìm Kiếm  
	                </a>
              </div>
             <div class="divthaotac" title="Xóa bộ lọc tìm kiếm"  align="center"> 
	                <a href="#" onclick="xoaboloctimlienhe()" >
	                 	 <span id='xoaboloc' class="xoaboloc"></span>
	                      Xóa bộ lọc 
	                </a>
            </div>
		</div>
		
		<!--  Hiển thị nội dung  -->
		<div class ="noidung_poup">
				<div class="box-l-n" style="clear:both;min-height: 200px !important;">

					<div class="box-l-n-body">
						<div class="box-l-n-wrr" style="border-top:2px solid #99BBE8;">
						<form id="danhsachlienhe" action="">
		    			<table cellspacing="1" id="danh_sachthu">
							<thead>
							<tr align="center">
								<td width="5" ><input id="check" type="checkbox" onclick="selectReverse('danhsachlienhe','lhid')" style="width: 50px" /></td>
								<th width="" ><b>Tên liên hệ </b></th>
								<td width="" ><b>Email  </b></td>
								<td width=""><b>Nhóm Liên hệ</b></td>
								
							</tr>
							</thead>
							<tbody id="data_pro">
							<?php foreach ($this->lienhedata as $lh ){?>
							<tr  class="lienhe_pro row_<?php echo  $lh['idlh'] ?> ">
								<td align="center" >
									<input type="checkbox" id="lhid_" value="<?php echo  $lh['idlh'] ?>" name="listlh[]"/>
									<input type="hidden" id="aremail_<?php echo  $lh['idlh'] ?>" value="<?php echo $lh['email']?>"/>
									<input type="hidden" id="arname_<?php echo  $lh['idlh'] ?>" value="<?php echo $lh['tenlh']?>"/>
								
								</td>
								
								<td width="" >
									<input type="hidden" id="company" value="" />
									 <b><?php echo $lh['tenlh'] ?></b>
								</td>
								<td width="" align="center">
									<?php echo $lh['email']?>
							    </td>
								<td width="" align="center">
									<?php echo $lh['ten_nhom_lh']?>
								</td>
								
							</tr>
								<?php }?>				
							</tbody>
						</table>
						</div>
						<!--  Phân Trang  -->

				    	<!--  end Trang  -->						
					</div>		
				</div>
		<!-- Phần đáy dưới cùng  -->
		         <div class="day_dơi">
		         	<span>
		         		<input type="button" value="Chọn" class="save" onclick="getemailvatenvato()" /> 
		         		<input type="button" value="Hủy bỏ" onclick="closepopuplienhe()" class="save" /> 
		         	</span>
		         </div>	
		         </form>	
		<!-- Phần đáy dưới cùng  -->		
				
		
		</div>
		<!-- End hiển thị nội dung  -->  
	</div>
</div>
<!--  Stop popup chon lien he -->




<!--  Start popup tim thu mau  -->
<div id= 'popupthumau' title="Chọn Thư Mẫu" style="display:none;">
<div class ="div_timkiem">
		<div class="left_tim" style="width: 36%;" >
		<span class="tex_tim">Tìm : <input id="keytimkiemthumau" type="text" name= "keytimkiemthumau" ></span> 
		</div>
		<div class="right_tim" style="width: 43%;" >
			<span class="tex_tim">Nhóm thư mẫu : 
				<select name="nhomthu" id="id_nhomthu">
					
				</select>
			</span> 
		</div>
		<div class="div_tim"  >
		     <div class="divthaotac" title="Tìm Kiếm" align="center"> 
                    <a href="#" onclick="timkiemthumaupopup()">
	                   <span class="timkiemhinh"></span>
	                    Tìm Kiếm  
	                </a>
              </div>
             <div class="divthaotac" title="Xóa bộ lọc tìm kiếm"  align="center"> 
	                <a href="#" onclick="getthumau()" >
	                 	 <span id='xoaboloc' class="xoaboloc"></span>
	                      Xóa bộ lọc 
	                </a>
            </div>
		</div>
		
		<!--  Hiển thị nội dung  -->
		<div class ="noidung_poup">
				<div class="box-l-n" style="clear:both;min-height: 200px !important;">

					<div class="box-l-n-body">
						<div class="box-l-n-wrr" style="border-top:2px solid #99BBE8;">
						<form id="danhsachthumau" action="">
		    			<table cellspacing="1" id="danh_sachthu">
							<thead>
							<tr align="center">
								<th width="" ><b>Tên Thư mẫu </b></th>
								<td width="" ><b>Ngày tạo  </b></td>
								<td width=""><b>Nhóm thư mẫu</b></td>
								<td width=""><b>Thao tác</b></td>
								
							</tr>
							</thead>
							<tbody id="data_thumau_pro">			
							</tbody>
						</table>
						</div>
						<!--  Phân Trang  -->

				    	<!--  end Trang  -->						
					</div>		
				</div>

		         </form>	
		<!-- Phần đáy dưới cùng  -->		
				
		
		</div>
		<!-- End hiển thị nội dung  -->  
	</div>
</div>
<!--  End popup tim thu mau  -->

<!--  start popup tim tron thu  -->
<div id="popuptronthu" title= "Chọn từ khóa" style="display:none;">
				<div class="box-l-n" style="clear:both;min-height: 200px !important;">

					<div class="box-l-n-body">
						<div class="box-l-n-wrr" style="border-top:2px solid #99BBE8;">
						<form id="danhsachthumau" action="">
		    			<table cellspacing="1" id="danh_sachthu">
							<thead>
							<tr align="center">
								<th width="" ><b>Tên Từ khóa  </b></th>
								<td width="" ><b>Mô tả  </b></td>
								<td width="10%"><b>Thao tác</b></td>
							</tr>
							</thead>
							<tbody id="data_tukhoa_pro">			
							</tbody>
						</table>
						</div>
						
					</div>		
				</div>	
</div>
<!-- Stop popup trộng thư -->
